Various types of electronic devices, such as heart rate monitors and peripheral capillary oxygen saturation (SpO2) monitors, perform functions that require both the emission and detection of light. For example, heart rate monitors may emit light (using, e.g., light-emitting diodes (LEDs)) in the direction of the human body and may detect the light that has reflected back toward the monitor. In such electronic devices, reflected light may be detected using photodiodes, which produce current as a function of the intensity of detected light. The photodiodes, however, detect ambient light in addition to reflected light generated by the electronic devices. The electronic devices attempt to cancel ambient light to the extent possible.